home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: A solution and another pointer question
- Date: Sun, 31 Mar 96 12:36:08 GMT
- Organization: none
- Distribution: world
- Message-ID: <828275768snz@genesis.demon.co.uk>
- References: <4jhhak$131a@sol.caps.maine.edu>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4jhhak$131a@sol.caps.maine.edu>
- bensh@gandalf.UMCS.Maine.EDU "Shawn Benn" writes:
-
- >FILE* fil;
- >char* filename = "junk"; /* junk used just as an example */
- >
- >fil = fopen(filename, "rb");
- >fseek(fil, 0L, SEEK_END);
- >
- >I get a Segmentation Fault error here trying to get to the end of the file.
- >
- >Any ideas? Thanks again for any help.
-
- Check the return code of fopen() for failure. Trying to pass a null pointer
- to fseek() results in undefined behaviour. Other than that the code is
- fine (or at least as much as we can see of it).
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-